package com.ghpt.controller;
import com.ghpt.pojo.FenBuShi;
import com.ghpt.service.FenBuShiService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/fenbushi")
public class FenBuShiController {
    private final FenBuShiService fenBuShiService;

    public FenBuShiController(FenBuShiService fenBuShiService) {
        this.fenBuShiService = fenBuShiService;
    }
    @GetMapping("/{id}")
    public FenBuShi getFenBuShiById(@PathVariable Long id) {
        System.out.println("结果是"+fenBuShiService.findFenBuShiById(id));
        return fenBuShiService.findFenBuShiById(id);
    }
    @PutMapping
    public int updateFenBuShi(@RequestBody FenBuShi fenBuShi) {
        return fenBuShiService.updateById(fenBuShi);
    }
}
